home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 August: Tool Chest / Apple_Developer_Group_August_1996_Tool_Chest.iso / Sample Code / Snippets / Toolbox / Modeless Dialog Sample / SampleHeader.h < prev   
Encoding:
C/C++ Source or Header  |  1994-02-23  |  2.5 KB  |  124 lines  |  [TEXT/MPS ]

  1. /*
  2.     ModelessSample - a sample application showing how to implement a 
  3.     modeless dialog with a couple of controls.
  4.  
  5.     Compiles with the PowerPC Universal interfaces for both 68K and 
  6.     PowerPC applications, which you can get from a Developer CD or AppleLink.
  7.     
  8.     In order to build this sample under MPW, you need to define PPCCincludes 
  9.     to point to the folder containing the Universal interfaces.  And
  10.     don't forget to drop the CodeFragmentTypes.r into your RIncludes
  11.     directory, or Rez won't know what to do with 'cfrg's for PowerPC builds.
  12.     
  13.     Nitin Ganatra, Apple Developer Technical Support
  14.     February 1994.
  15. */
  16.  
  17. #ifndef __QUICKDRAW__
  18. #include <QuickDraw.h>
  19. #endif
  20.  
  21. #ifndef __DIALOGS__
  22. #include <Dialogs.h>
  23. #endif
  24.  
  25. #ifndef __FONTS__
  26. #include <Fonts.h>
  27. #endif
  28.  
  29. #ifndef __PROCESSES__
  30. #include <Processes.h>
  31. #endif
  32.  
  33. #ifndef __TEXTEDIT__
  34. #include <TextEdit.h>
  35. #endif
  36.  
  37. #ifndef __MENUS__
  38. #include <Menus.h>
  39. #endif
  40.  
  41. #ifndef __MEMORY__
  42. #include <Memory.h>
  43. #endif
  44.  
  45. #ifndef __ERRORS__
  46. #include <Errors.h>
  47. #endif
  48.  
  49. #ifndef __SCRAP__
  50. #include <Scrap.h>
  51. #endif
  52.  
  53. #ifndef __TOOLUTILS__
  54. #include <ToolUtils.h>
  55. #endif
  56.  
  57. #ifndef __WINDOWS__
  58. #include <Windows.h>
  59. #endif
  60.  
  61. #ifndef __TEXTUTILS__
  62. #include <TextUtils.h>
  63. #endif
  64.  
  65. enum {
  66.     kMenuBarResID = 128,
  67.     kAboutBoxDITLID = 128,
  68.     kModelessDialogID = 200
  69. };
  70.  
  71. enum {
  72.     kOkayButton = 1,
  73.     kCancelButton,
  74.     kEditCheckItem,
  75.     kEditTextField,
  76.     kEditUserItem,
  77.     kOkayUserItem
  78. };
  79.  
  80. enum {
  81.     kCutItem = 1,
  82.     kCopyItem,
  83.     kPasteItem,
  84.     kClearItem,
  85.     kAppleMenu = 128,
  86.     kFileMenu,
  87.     kEditMenu
  88. };
  89.  
  90. enum {
  91.     kNewItem = 1,
  92.     kQuitItem
  93. };
  94.  
  95. void InitApplication(void);
  96. void CreateNewWindow(void);
  97. void MainEventLoop(void);
  98. Boolean MenuCommand(long);
  99. void DoAboutBox(void);
  100. void PreEventLoop(void);
  101. void PostEventLoop(void);
  102. pascal void DrawWindowContent(short, short, GDHandle, long);
  103. void DrawIt(WindowPtr);
  104. void DoUpdate(WindowPtr);
  105. void AdjustMenus(void);
  106.  
  107. Boolean EventFilter(EventRecord *theEvent, WindowPtr theFrontWindow);
  108. void CreateModelessDialog(void);
  109. void DoDialogEvent(EventRecord *);
  110. void DoDialogNullEvent(EventRecord *);
  111. void DoCut(DialogPtr);
  112. void DoCopy(DialogPtr);
  113. void DoPaste(DialogPtr);
  114. void DoClear(DialogPtr);
  115.  
  116. static void HiliteAllControls(DialogPtr, short);
  117. static void DisableDialogControl(DialogPtr, short);
  118. static void SetDialogControlHilite(DialogPtr, short, Boolean);
  119. static ControlHandle GetCtlHandle(DialogPtr, short);
  120. static void InvalThisItemRect(DialogPtr, short);
  121. static void FakeButtonHilite(DialogPtr, short);
  122. static pascal void DrawButtonBorder(WindowPtr, short);
  123. static pascal void DimEditLine(WindowPtr, short);
  124.